<template>
  <div id="app" class="app-page">
    <root>
      <safe-header
        v-bind="{
          title: '源单查询',
          isBack: true,
          backIconColor: '#fff',
          fixedTop: true,
        }"
      />
      <div>

        <!--列表-->
        <v-container width:80%>
          <v-card
            class="mx-auto my-2 list_card"
            max-width="374"
            v-for="item in inventoryOrderList"
            :key="item.code"
            outlined
            @click="warehouseOrderClick(item)"
            style="board: thin solid #cacbcc"
          >
            <!--<v-card-title class="pb-3 card-title">-->
              <!--<v-row>-->
                <!--&lt;!&ndash;<v-col cols="10" class="py-0 d-flex align-center">{{ item.billNo}}&ndash;&gt;-->
                  <!--&lt;!&ndash;<span class="ms-2 card-tag">{{item.statesLabel}}</span>&ndash;&gt;-->
                <!--&lt;!&ndash;</v-col>&ndash;&gt;-->
              <!--<v-col class="text-right py-0 pr-0 d-flex align-center justify-end">-->
                  <!--<v-icon color="#CACBCC">{{ svgpath }}</v-icon></v-col>-->
              <!--</v-row>-->
            <!--</v-card-title>-->
            <!--<v-divider class="my-0 card-sp-line"></v-divider>-->

            <v-card-text>
              <v-row >
                <v-col cols="3" class="py-1"  style="color: #999999">盘点单号</v-col>
                <v-col class="ms-2 py-1 text-right" style="font-size: 0.75rem; color: #666666">
                  {{ item.billNo }}
                </v-col>
              </v-row>

              <v-row>
                <v-col cols="3" class="py-1" style="color: #999999">盘点类型</v-col>
                <v-col class="ms-2 py-1 text-right" style="font-size: 0.75rem; color: #666666">
                  {{ item.type==1?'随机抽盘':(item.type==2?'指定货位盘点':'全盘') }}
                </v-col>
              </v-row>

              <v-row class="d-flex flex-row justify-space-between">
                <v-col cols="4" class="py-1 card-lable">计划盘点时间</v-col>
                <v-col class="ms-2 py-1 text-right card-value">
                  {{ item.dynamicFromTime }}
                </v-col>
              </v-row>

              <v-row>
                <v-col cols="3" class="py-1" style="color: #999999">创建人</v-col>
                <v-col class="ms-2 py-1 text-right" style="font-size: 0.75rem; color: #666666">
                  {{ item.createUserName }}
                </v-col>
              </v-row>

              <v-row class="d-flex flex-row justify-space-between">
                <v-col cols="3" class="py-1 card-lable">创建日期</v-col>
                <v-col class="ms-2 py-1 text-right card-value">
                  {{ item.createTime }}
                </v-col>
              </v-row>
            </v-card-text>
          </v-card>
        </v-container>


      </div>
    </root>
  </div>
</template>

<script>
import SafeHeader from "../../components/safeHeader_wms";
import Storage from "@/utils/storage.js";
import wms from "../../utils/http.js";
import { apiList } from "@/static/apiList";
import { mdiChevronRight, mdiMagnify } from "@mdi/js";
import Root from "@/components/Root.vue";

export default {
  name: "Inventory_OrderList",
  components: {
    SafeHeader,
    Root,
  },
  data() {
    return {
      showList:true,
      showEmpty:true,
      list: [],
      svgpath: mdiChevronRight,
      mdiMagnify: mdiMagnify,
      value: "",
       infoList: [],
      inventoryOrderList: [],
    };
  },
  computed: {},
  methods: {

      //点击盘点单号携带单号跳转盘点任务页面(inventory)回显参数
    warehouseOrderClick(item) {
      console.log(`----------------------------------------${item.billNo}`);
      if (window.navigator.userAgent.toLowerCase().includes("apicloud")) {
        window.api.sendEvent({
          name: "Inventory",
          extra: {
            billNo: item.billNo,
          },
        });
        window.api.openWin({
          name: "Inventory",
          url: "./Inventory.html",
          pageParam: {
            billNo: item.billNo,
          },
        });
      } else {
        this.$root.api.api.sendEvent({
          name: "Inventory",
          extra: {
            billNo: item.billNo,
          },
        });
        this.$root.api.api.openWin({
          name: "Inventory",
          url: "./Inventory.html",
          pageParam: {
            billNo: item.billNo,
          },
        });
      }
    },
  },
  mounted() {
    let params = {
      wareId: Storage.getObject("loginConfig").wareIds[0],
      state: 0
    };
    wms.get({ url: "/stock/take/masters/list", data: params }).then((res) => {
      console.log(res);
      this.infoList = res.data.data.list;
      let asnStates = apiList.asnStates;
      this.infoList.forEach((item) => {
        asnStates.forEach((val) => {
          if (item.asnState == val.value) {
            item.statesLabel = val.label;
          }
        });
      });
      this.inventoryOrderList = this.infoList;
    });
  },
};
</script>

<style lang="scss" scoped>
  .line{
    border: 1px solid #f4f1f9;
  }
</style>
